<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<script type="text/javascript">
	$(document).ready(function(){
		$("#write").click(function(){
			if(confirm("문의글을 쓰시겠습니까?")){
				location.href="ViewWriteQuestionBoard.do";
			}else{
				return;
			}
		});
	});
</script>
	<h3>문의 게시판</h3>
	<table border="1" cellpadding="5" width="700">
		<thead align="center">
			<tr>
				<th width="10%">글번호</th>
				<th width="50%">글제목</th>
				<th width="15%">작성자</th>
				<th width="15%">작성일</th>
				<th width="10%">조회수</th>
			</tr>
		</thead>
		<tbody align="center">
			<c:forEach var="qvo" items="${requestScope.lvo.list}">		
				<tr>
			    	<td>${qvo.no }</td>	
			    	<td align="left">
						<c:if test="${qvo.relevel!=0}">
							<c:forEach begin="0" end="${qvo.relevel}" step="1">
							&nbsp;&nbsp;
							</c:forEach>
							↳
						</c:if>
						<c:choose>
							<c:when test="${sessionScope.cvo.id==qvo.id || sessionScope.svo!=null || sessionScope.cvo.id==qvo.replyId}">
								<a href="showContent.do?no=${qvo.no }&pageNo=${requestScope.lvo.pagingBean.nowPage}&count=${qvo.count}">${qvo.title}</a>
							</c:when>
							<c:otherwise>
								${qvo.title}
							</c:otherwise>
						</c:choose>
					</td>									
					<td>${qvo.id }</td>
					<td>${qvo.questionDate }</td>
					<td>${qvo.count }</td>
				</tr>		
			</c:forEach>
		</tbody>
		<tfoot align="center">
			<tr>
				<td colspan="5">
					<!-- 페이징 처리 -->	
	 				<!-- 이전 페이지그룹이 있으면 왼쪽화살표를 보여준다 -->
	 				<c:if test="${requestScope.lvo.pagingBean.previousPageGroup}">
	 					<a href="getQuestionBoardList.do?pageNo=${requestScope.lvo.pagingBean.startPageOfPageGroup-1}">◀</a>
					</c:if>	
					&nbsp;
					<!-- 현재 페이지그룹의 페이지 갯수를 보여준다 누르면 현재 페이지의 게시물 보여준다 -->
					<c:forEach var="i" begin="${requestScope.lvo.pagingBean.startPageOfPageGroup}" end="${requestScope.lvo.pagingBean.endPageOfPageGroup}">
	 					<c:choose>
	 						<c:when test="${requestScope.lvo.pagingBean.nowPage!=i}">
	 							<a href="getQuestionBoardList.do?pageNo=${i}">${i}</a>
	 						</c:when>
	 						<c:otherwise>
								${i}
							</c:otherwise>
						</c:choose>
					</c:forEach>	 
					&nbsp;
					<!-- 이후 페이지그룹이 있으면 오른쪽화살표를 보여준다 -->
	 				<c:if test="${requestScope.lvo.pagingBean.nextPageGroup}">
	 					<a href="getQuestionBoardList.do?pageNo=${requestScope.lvo.pagingBean.endPageOfPageGroup+1}">▶</a>
	 				</c:if>	
				</td>
			</tr>
		</tfoot>
	</table>
	<br>
	<input type="button" id="write" value="문의 하기">
